/**
 * Copyright (c) 2011-2017, James Zhan 詹波 (jfinal@126.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package xin.xinny.log;

import com.jfinal.log.Log;
import org.apache.log4j.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class LogbackLog extends Log {

	private Logger log;
	private static final String callerFQCN = LogbackLog.class.getName();

	LogbackLog(Class<?> clazz) {
		log = LoggerFactory.getLogger(clazz);
	}

	LogbackLog(String name) {
		log = LoggerFactory.getLogger(name);
	}
	
	public static LogbackLog getLog(Class<?> clazz) {
		return new LogbackLog(clazz);
	}
	
	public static LogbackLog getLog(String name) {
		return new LogbackLog(name);
	}
	
	public void info(String message) {
		log.info(message);
	}
	
	public void info(String message, Throwable t) {
		log.info(message, t);
	}
	
	public void debug(String message) {
		log.debug(message);
	}
	
	public void debug(String message, Throwable t) {
		log.debug(message, t);
	}
	
	public void warn(String message) {
		log.warn(message);
	}
	
	public void warn(String message, Throwable t) {
		log.warn( message, t);
	}
	
	public void error(String message) {
		log.error(message);
	}
	
	public void error(String message, Throwable t) {
		log.error( message, t);
	}
	
	public void fatal(String message) {
		error(message);
	}
	
	public void fatal(String message, Throwable t) {
		error(message,t);
	}
	
	public boolean isDebugEnabled() {
		return log.isDebugEnabled();
	}
	
	public boolean isInfoEnabled() {
		return log.isInfoEnabled();
	}
	
	public boolean isWarnEnabled() {
		return log.isWarnEnabled();
	}
	
	public boolean isErrorEnabled() {
		return log.isErrorEnabled();
	}
	
	public boolean isFatalEnabled() {
		return isErrorEnabled();
	}
}

